const router = require('koa-router')()

// const users = require('./users')
const test = require('./test')
import admin from './admin'
import v1 from './v1'
import shopping from './shopping'

router.get('/', async (ctx, next) => {
  await ctx.render('index', {
    title: 'Hello 欢迎使用elm，api接口!'
  })
})

// 用户api
router.use('/api/admin', admin.routes(), admin.allowedMethods());
// 导入v1版本api
router.use('/api/v1', v1.routes(), v1.allowedMethods());
// 商品api
router.use('/api/shopping', shopping.routes(), shopping.allowedMethods());
// router.use('/users', users.routes(), users.allowedMethods());
router.use('/api/test', test.routes(), test.allowedMethods());

module.exports = router
